package com.ifonly.common;

/**
 * @author <a href="mailto:ifonlymaster@163.com">ifonly</a>
 * @version 1.0 2015-12-25 11:54
 * @since JDK 1.6
 */
public final class Assert {

    public static boolean isNull(Object o) {
        return checkNull(o, "object must be not null");
    }

    public static boolean checkNull(Object o, String message) {
        if (o == null) {
            throw new NullPointerException(message);
        }
        return false;
    }

    public static boolean isTrue(boolean b) {
        return checkTrue(b, "param be true");
    }

    public static boolean checkTrue(boolean b, String message) {
        if (!b) {
            throw new IllegalArgumentException(message);
        }
        return true;
    }

}
